﻿using Biotech.Utils;
using project.B12.IService;
using project.B12.Model.BaseModel;
using project.B12.Model.Enums;
using project.B12.Model.Models;
using software.Common.MVVM;
using software.dll.user;
using System.Collections.ObjectModel;
using System.Xml.Linq;

namespace project.B12.Service.UserService
{
    public partial class UserService : ObservableObject, IUserService
    {
        #region Method
        /// <summary>
        /// 更新账户的密码信息
        /// </summary>
        /// <returns></returns>
        public MessageModel ChangePassword(string name, string newPassword)
        {
            try
            {
                var flag = _userManager.UpdateUserPassword(name, newPassword);
                if (flag) 
                {
                    return MessageModel.ReturnSuccess();//成功
                }
                else
                    return MessageModel.ReturnFail("Password modification failed");//失败
            }
            catch (Exception ex)
            {
                return MessageModel.ReturnFail(ex.ToString());//失败
            }
        }
        #endregion
    }
}
